package org.jypj.dev.vo.hxVo;

import com.google.gson.Gson;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by chenyuyuyu on 2017/3/19.
 */
public class PushObject<T> {

    private String pushType = ""; //推送类型
    private String pushTime;//推送时间
    private String pushTitle = "";//推送标题
    private String pushContent = "";//推送内容
    private T pushValue;//推送值

    public PushObject() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        this.pushTime = sdf.format(new Date());
    }

    public PushObject(String pushType, T pushValue) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        this.pushTime = sdf.format(new Date());
        this.pushType = pushType;
        this.pushValue = pushValue;
    }

    public PushObject(String pushType, String pushTitle, String pushContent, T pushValue) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        this.pushTime = sdf.format(new Date());
        this.pushType = pushType;
        this.pushTitle = pushTitle;
        this.pushContent = pushContent;
        this.pushValue = pushValue;
        System.out.println(toString());
    }

    public String getPushType() {
        return pushType;
    }

    public void setPushType(String pushType) {
        this.pushType = pushType;
    }

    public String getPushTime() {
        return pushTime;
    }

    public void setPushTime(String pushTime) {
        this.pushTime = pushTime;
    }

    public String getPushTitle() {
        return pushTitle;
    }

    public void setPushTitle(String pushTitle) {
        this.pushTitle = pushTitle;
    }

    public String getPushContent() {
        return pushContent;
    }

    public void setPushContent(String pushContent) {
        this.pushContent = pushContent;
    }

    public T getPushValue() {
        return pushValue;
    }

    public void setPushValue(T pushValue) {
        this.pushValue = pushValue;
    }

    @Override
    public String toString() {

        return new Gson().toJson(this);
    }
}
